package com.ytt.core.model.user;

import com.ytt.core.model.schoolClass.SchoolClassDto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import javax.validation.constraints.Email;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Null;
import javax.validation.constraints.Size;
import java.util.Date;
import java.util.Set;

/**
 * UserDto
 *
 * @author chenwen
 * @date 2019/9/12 16:07
 */
@ApiModel(description = "用户信息")
@Getter
@Setter
@ToString(callSuper = true)
public class UserDto {
    @ApiModelProperty(position = 1, notes = "对象ID，新增时应当为null, 系统会自动生成", required = true)
    private String id;

    @ApiModelProperty(position = 110, value = "登录账号, 要求在创建时验证唯一性", required = true)
    @NotNull
    @Size(min = 1, max = 20)
    private String account;

    @ApiModelProperty(position = 120, value = "姓名", required = true)
    @NotNull
    @Size(min = 1, max = 20)
    private String name;

    @ApiModelProperty(position = 120, value = "邮箱", required = true)
    @Email
    @NotNull
    private String mail;

    @ApiModelProperty(position = 130, value = "密码", required = true)
    @Size(min = 8, max = 88)
    private String password;

    @ApiModelProperty(position = 140, value = "密码失效时间, null表示永久有效", example = "2018-12-31 23:59:59")
    private Date passwordExpireDate;

    @ApiModelProperty(position = 150, value = "账号是否激活", required = true)
    @NotNull
    private Boolean enabled;

    @ApiModelProperty(position = 151, value = "账号失效时间，null表示永久有效", example = "2018-12-31 23:59:59")
    private Date accountExpireDate;

    @ApiModelProperty(position = 160, value = "是否本地登录账号，非本地账号需要连接OA或其他系统验证登录", required = true)
    @NotNull
    private Boolean localAccount;

    @ApiModelProperty(position = 310, value = "账号是否被锁住（通常是连续输错密码）")
    @Null
    private Boolean accountLocked;

    @ApiModelProperty(position = 320, value = "权限（所属角色和所属组织的权限）")
    private Set<String> authorities;

    @ApiModelProperty(position = 110, value = "数据访问范围，后端自动生成")
    @Size(max = 380)
    private String filterPath;

    @ApiModelProperty(position = 110, value = "用户所属班级")
    @Size(max = 380)
    private SchoolClassDto schoolClass;

}
